package com.xuelang.pipeline.client.pipeline;

import com.xuelang.pipeline.client.common.request.PageParam;
import com.xuelang.pipeline.client.common.result.ApiResult;
import com.xuelang.pipeline.client.common.result.PageRecord;
import com.xuelang.pipeline.client.pipeline.dto.PipelineTemplateConfigDTO;
import com.xuelang.pipeline.client.pipeline.dto.PipelineTemplateCopyDTO;
import com.xuelang.pipeline.client.pipeline.dto.PipelineTemplateDTO;
import com.xuelang.pipeline.client.pipeline.dto.PipelineTemplateQuery;
import org.springframework.web.bind.annotation.*;

import jakarta.validation.Valid;
import java.util.List;

/**
 * 流水线模板服务API
 *
 * @author xiwen.zxg
 * @since 2024/5/15
 */
public interface IPipelineTemplateService {

    /**
     * 查询流水线模板列表(有过滤条件，可以分页)
     *
     * @param dtoPageParam
     * @return
     */
    @PostMapping(value = "/pageList", produces = "application/json;charset=utf-8")
    ApiResult<PageRecord<PipelineTemplateDTO>> pagePipelineTemplateList(@RequestBody @Valid PageParam<PipelineTemplateQuery> dtoPageParam);

    /**
     * 查询流水线模板列表(有过滤条件)
     *
     * @param pipelineTemplateQuery
     * @return
     */
    @PostMapping(value = "/list", produces = "application/json;charset=utf-8")
    ApiResult<List<PipelineTemplateDTO>> conditionalPipelineTemplateList(@RequestBody @Valid PipelineTemplateQuery pipelineTemplateQuery);

    /**
     * 新增流水线模板
     *
     * @param pipelineTemplateConfigDTO
     * @return
     */
    @PostMapping(value = "", produces = "application/json;charset=utf-8")
    ApiResult<Boolean> addPipelineTemplate(@RequestBody @Valid PipelineTemplateConfigDTO pipelineTemplateConfigDTO);

    /**
     * 更新流水线模板
     *
     * @param pipelineTemplateConfigDTO
     * @return
     */
    @PutMapping(value = "", produces = "application/json;charset=utf-8")
    ApiResult<Boolean> updatePipelineTemplate(@RequestBody @Valid PipelineTemplateConfigDTO pipelineTemplateConfigDTO);

    /**
     * 删除流水线模板
     *
     * @param pipelineTemplateUuid 流水线模板UUID
     * @return
     */
    @DeleteMapping(value = "/{pipelineTemplateUuid}", produces = "application/json;charset=utf-8")
    ApiResult<Boolean> deletePipelineTemplate(@PathVariable("pipelineTemplateUuid") String pipelineTemplateUuid);

    /**
     * 查询流水线模板
     *
     * @param pipelineTemplateUuid 流水线模板UUID
     * @return
     */
    @GetMapping(value = "/{pipelineTemplateUuid}", produces = "application/json;charset=utf-8")
    ApiResult<PipelineTemplateDTO> queryPipelineTemplate(@PathVariable("pipelineTemplateUuid") String pipelineTemplateUuid);

    /**
     * 获取流水线模板配置信息
     *
     * @param pipelineTemplateUuid 流水线模板UUID
     * @return
     */
    @GetMapping(value = "/pipelineTemplateConfig/{pipelineTemplateUuid}", produces = "application/json;charset=utf-8")
    ApiResult<PipelineTemplateConfigDTO> queryPipelineTemplateConfig(@PathVariable("pipelineTemplateUuid") String pipelineTemplateUuid);

    /**
     * 复制 流水线模板
     *
     * @param pipelineTemplateCopyDTO 流水线拷贝数据
     * @return
     */
    @PostMapping(value = "/copy", produces = "application/json;charset=utf-8")
    ApiResult<Boolean> copyPipelineTemplate(@RequestBody PipelineTemplateCopyDTO pipelineTemplateCopyDTO);

}
